package com.chushouya.order.constants;



import com.general.framework.core.enums.IEnum;
import com.general.framework.core.lang.Strings;

import java.util.Objects;

public enum SfOpCodeEnum implements IEnum<String> {

    //50=已揽收
    //80 =已签收
    TRANSIT_30("30","到集散中心"),

    TRANSIT_31("31","发集散中心"),

    RECEIVED("50","已揽收"),
    SIGNED("80","已签收");

    private String value;

    private String desc;

    SfOpCodeEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static String getDesc(String status) {
        for (SfOpCodeEnum thisEnum : SfOpCodeEnum.values()) {
            if (Objects.equals(thisEnum.value, status)) {
                return thisEnum.desc;
            }
        }
        return Strings.EMPTY;
    }
    public String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }
    /**
     * 通过value取枚举
     * @param value
     * @return
     */
    public static SfOpCodeEnum getTypeByValue(String value){
                for (SfOpCodeEnum enums : SfOpCodeEnum.values()) {
            if (enums.getValue() == value) {
                return enums;
            }
        }
        return null;
    }
    @Override
    public String value() {
        return this.value;
    }

    @Override
    public String named() {
        return this.desc;
    }
}
